﻿
@{
    ViewData["Title"] = "Index";
}

<form method="post" enctype="multipart/form-data">
    <input type="file" id="files"
           name="files" multiple />
    <input type="button"
           id="upload"
           value="上传" onclick="Asd()"  />
</form>



<script type="text/javascript">
    $(function Asd(){
        $("#upload").click(function (evt) {
            var fileUpload = $("#files").get(0);
            var files = fileUpload.files;
            var data = new FormData();
            for (var i = 0; i < files.length; i++) {
                data.append(files[i].name, files[i]);
            }
            $.ajax({
                type: "POST",
                url: "/Picture/UploadFilesAjax",
                contentType: false,
                processData: false,
                data: data,
                success: function (message) {
                    alert(message);
                },
                error: function () {
                    alert("There was error uploading files!");
                }
            });
        });
    });
</script>